<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">

  /* tooltip */
  #tooltip{
    position:absolute;
    border:1px solid #ccc;
    background:#333;
    padding:2px;
    display:none;
    color:#fff;
  }
  </style>

</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">诉求管理</li>
        <li><a href="{:url('admin/user/publishred')}" class="a_menu">发起诉求</a></li>
      </ul>
    </div> 
      <form class="layui-form serch" action="" method="post">
        <div class="layui-form-item" style="float: left;">
          <div class="layui-input-inline">
            <input type="text" name="keywords" lay-verify="title" autocomplete="off" placeholder="请输入关键词" class="layui-input layui-btn-sm">
          </div>
          <div class="layui-input-inline">
            <div class="layui-inline">
                <select name="status" lay-search="">
                  <option value="">状态</option>
                  <option value="0">待审核</option>
                  <option value="1">已审核</option>
                </select>
            </div>
          </div>
          <!-- <div class="layui-input-inline">
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input type="text" class="layui-input" id="create_time" placeholder="创建时间" name="create_time">
              </div>
            </div>
          </div> -->
          <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">检索</button>
        </div>
      </form> 
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="100">
        <col width="100">
        <col width="200">
        <col width="150">
        <col width="300">
        <col width="100">
        <col width="50">
        <col width="100">
        <col width="50">
        <col width="50">
        <col width="100">
      </colgroup>
      <thead>
        <tr>
          <th>诉求类型</th>
          <th>发起人</th>
          <th>问题描述</th>
          <th>现场图片</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
          <tr>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td class="operation-menu">
                <div class="layui-btn-group">
                  <a href="javascript:;" id='' class="layui-btn layui-btn-xs layui-btn-primary delete" id="" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
                </div>
              </td>
          </tr>
      </tbody>
    </table>
    <div style="padding:0 20px;"></div> 
    {include file="public/foot"}
    <script type="text/javascript">

    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要降为普通用户?', function(index) {
        $.ajax({
          url:"{:url('admin/user/red')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
                layer.alert('降级成功！',{icon:1});
                location.reload();
            }
          }
        })
      })
    })
    </script>
    <script type="text/javascript">

    $('.is_top').click(function(){
      var val = $(this).attr('data-val');
      var id = $(this).attr('data-id');
      var i = $(this).find('i');
      var the = $(this);
      if(val == 1){
        var is_top = 0;
      } else {
        var is_top = 1;
      }
      $.ajax({
        type:"post",
        url:"{:url('admin/article/is_top')}",
        data:{is_top:is_top,id:id},
        success:function(res){
          
          if(res.code == 1) {
            top();
          } else {
            layer.msg(res.msg);
          }
        }
      })

      function top(){
        if(val == 1){
          i.attr("class","fa fa-toggle-off");
          the.attr('data-val',0);
        } else {
          i.attr("class","fa fa-toggle-on");
          the.attr('data-val',1);
        }
      }
    })


    $('.status').click(function(){
      var val = $(this).attr('data-val');
      var id = $(this).attr('data-id');
      var i = $(this).find('i');
      var the = $(this);
      if(val == 1){
        var status = 0;
      } else {
        var status = 1;
      }
      $.ajax({
        type:"post",
        url:"{:url('admin/article/status')}",
        data:{status:status,id:id},
        success:function(res){
          
          if(res.code == 1) {
            tostatus();
          } else {
            layer.msg(res.msg);
          }
        }
      })

      function tostatus(){
        if(val == 1){
          i.attr("class","fa fa-toggle-off");
          the.attr('data-val',0);
        } else {
          i.attr("class","fa fa-toggle-on");
          the.attr('data-val',1);
        }
      }
    })
    </script>
  </div>
</body>
</html>